﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class user_User : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {

            
                          
            if (Session["login"] == null)
            {
                lblUser.Text = "[Guest]";
                formlogin1.Visible = true;
                LinkExit.Visible = false;
            }
            else
            {
                lblUser.Text = Session["email"].ToString();
                formlogin1.Visible = false;
                LinkExit.Visible = true;
            }
            LoadAllCategory();
        }

        //load mycart
        lb.Text = "("+ShoppingCart.Instance.Items.Count.ToString()+")";
        lblHitCouter.Text = "Hit counter: "+Application["HitCounter"].ToString();
        lblCounterOnline.Text = "User Online: "+Application["CounterOnline"].ToString();
 
    }

    public void LoadAllCategory()
    {
        CategoryBus ctBus = new CategoryBus();
        dtListCategory.DataSource = ctBus.GetAllCategory();
        dtListCategory.DataBind();

    }
    protected void LinkExit_Click(object sender, EventArgs e)
    {
        Session.Abandon();
        Response.Redirect("default.aspx");
    }
    
}
